home *** CD-ROM | disk | FTP | other *** search
-
-
-
- BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222)))) BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))
-
-
-
- NNNNAAAAMMMMEEEE
- blockproc, unblockproc, setblockproccnt, blockprocall, unblockprocall,
- setblockproccntall - routines to block/unblock processes
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////pppprrrrccccttttllll....hhhh>>>>
-
- iiiinnnntttt bbbblllloooocccckkkkpppprrrroooocccc ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
-
- iiiinnnntttt uuuunnnnbbbblllloooocccckkkkpppprrrroooocccc ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
-
- iiiinnnntttt sssseeeettttbbbblllloooocccckkkkpppprrrrooooccccccccnnnntttt ((((ppppiiiidddd____tttt ppppiiiidddd,,,, iiiinnnntttt ccccoooouuuunnnntttt))));;;;
-
- iiiinnnntttt bbbblllloooocccckkkkpppprrrrooooccccaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
-
- iiiinnnntttt uuuunnnnbbbblllloooocccckkkkpppprrrrooooccccaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
-
- iiiinnnntttt sssseeeettttbbbblllloooocccckkkkpppprrrrooooccccccccnnnnttttaaaallllllll ((((ppppiiiidddd____tttt ppppiiiidddd,,,, iiiinnnntttt ccccoooouuuunnnntttt))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These routines provide a complete set of blocking/unblocking capabilities
- for processes. Blocking is implemented with a counting semaphore in the
- kernel. Each call to _b_l_o_c_k_p_r_o_c decrements the count. When the count
- becomes negative, the process is suspended. When _u_n_b_l_o_c_k_p_r_o_c is called,
- the count is incremented. If the count becomes non-negative (>= 0), the
- process is restarted. This provides both a simple, race free
- synchronization ability between two processes and a much more powerful
- capability to synchronize multiple processes.
-
- In order to guarantee a known starting place, the _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t
- function may be called, which will force the semaphore count to the value
- given by _c_o_u_n_t. New processes have their semaphore zeroed. Normally,
- _c_o_u_n_t should be set to 0. If the resulting block count is greater than
- or equal to zero and the process is currently blocked, it will be
- unblocked. If the resulting block count is less than zero, the process
- will be blocked. Using this, a simple rendezvous mechanism can be set
- up. If one process wants to wait for _n other processes to complete, it
- could set its block count to -_n. This would immediately force the process
- to block. Then as each process finishes, it unblocks the waiting
- process. When the _n'_t_h process finishes the waiting process will be
- awakened.
-
- The _b_l_o_c_k_p_r_o_c_a_l_l, _u_n_b_l_o_c_k_p_r_o_c_a_l_l, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t_a_l_l system calls
- perform the same actions as _b_l_o_c_k_p_r_o_c, _u_n_b_l_o_c_k_p_r_o_c, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t,
- respectively, but act on all processes in the given process' share group.
- A share group is a group of processes created with the _s_p_r_o_c(_2) system
- call. If a process does not belong to a share group, the effect of the
- plural form of a call will be the same as that of the singular form.
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222)))) BBBBLLLLOOOOCCCCKKKKPPPPRRRROOOOCCCC((((2222))))
-
-
-
- A process may block another provided that standard UNIX permissions are
- satisfied.
-
- A process may determine whether another is blocked by using the _p_r_c_t_l(_2)
- system call. It should be noted that since other processes may unblock
- the subject process at any time, the answer should be interpreted as a
- snapshot only.
-
- These interfaces are not supported for POSIX Threads applications.
-
- These routines will fail and no operation will be performed if one or
- more of the following are true:
-
- [ESRCH] The _p_i_d specified does not exist.
-
- [EPERM] The caller is not operating on itself, its effective user
- ID is not super-user, and its real or effective user ID
- does not match the real or effective user ID of the target
- process.
-
- [EPERM] The target process is a POSIX Threads application.
-
- [EINVAL] The count value that would result from the requested
- _b_l_o_c_k_p_r_o_c, _u_n_b_l_o_c_k_p_r_o_c or _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t is less than
- PPPPRRRR____MMMMIIIINNNNBBBBLLLLOOOOCCCCKKKKCCCCNNNNTTTT or greater than PPPPRRRR____MMMMAAAAXXXXBBBBLLLLOOOOCCCCKKKKCCCCNNNNTTTT as defined
- in _s_y_s/_p_r_c_t_l._h.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- sproc(2), prctl(2).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Upon successful completion, 0 is returned. Otherwise, a value of -1 is
- returned to the calling process, and _e_r_r_n_o is set to indicate the error.
- When using the _b_l_o_c_k_p_r_o_c_a_l_l, _u_n_b_l_o_c_k_p_r_o_c_a_l_l, and _s_e_t_b_l_o_c_k_p_r_o_c_c_n_t_a_l_l
- calls, an error may occur on any of the processes in the share group.
- These calls will attempt to perform the given action on each process in
- the share group despite earlier errors, and set _e_r_r_n_o to indicate the
- error of the last failure to occur.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-